package unittest.docsync;

import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import docsync.doclist.DocListRequest;

public class UnitTestClientLogin {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception {

		DocListRequest req = new DocListRequest("207project@gmail.com",
				"207group04");
		String url = "https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=0Ap4uli1JTzkOdHVDTmlVOHJMbFV6RUhZZEsxWHNwWXc";
		InputStream is = req.export(url, "xls");
		File file = new File("mytestoutput.xls");
		OutputStream os = new FileOutputStream(file);
		int ct = 0;
		byte[] buf = new byte[1024];
		while ((ct = is.read(buf)) > 0) {
			os.write(buf, 0, ct);
		}
		is.close();
		os.close();
		System.out.println("Export Okay");

		// req.upload("mytestoutput.xls", file, "application/vnd.ms-excel");
		// System.out.println("Upload Okay");

	}

}
